package org.suigara.d3.util;

import java.net.MalformedURLException;
import java.net.URL;

import javax.swing.ImageIcon;

public class ImageUtils {
	private static final String ITEM_IMAGE_URL = "http://media.blizzard.com/d3/icons/items/large/";
	private static final String SKILL_IMAGE_URL = "http://media.blizzard.com/d3/icons/skills/42/";

	public static ImageIcon getItemImage(String iconName) {
		ImageIcon imageIcon;
		try {
			imageIcon = new ImageIcon(new URL(ITEM_IMAGE_URL + iconName + ".png"));
		} catch (MalformedURLException e) {
			return null;
		}

		return imageIcon;
	}
	
	public static ImageIcon getSkillImage(String iconName) {
		ImageIcon imageIcon;
		try {
			imageIcon = new ImageIcon(new URL(SKILL_IMAGE_URL + iconName + ".png"));
		} catch (MalformedURLException e) {
			return null;
		}

		return imageIcon;
	}
	public static ImageIcon getHeroPortraitsImage() {
		ImageIcon imageIcon;
		try {
			imageIcon = new ImageIcon(new URL("http://tw.battle.net/d3/static/images/profile/hero/hero-nav-portraits.jpg"));
		} catch (MalformedURLException e) {
			return null;
		}

		return imageIcon;
	}
	
	
}
